package com.itjh.controller;

import com.itjh.AliYunOssUtils;
import com.itjh.pojo.MyResponseResult;
import com.itjh.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * Description:
 *
 * @Create 2025/1/17 23:28
 */

@RestController
//@RequestMapping("upload")
public class UploadController {

    @Autowired
    private AliYunOssUtils aliYunOssUtils;

    @Autowired
    private FileService fileService;

    @PostMapping("/upload")
    public MyResponseResult<Object> upload(@RequestParam(name = "image") MultipartFile image) {
        String s = aliYunOssUtils.uploadToOss(image);
//        String filePath = fileService.saveFile(image);
        return MyResponseResult.success(s);
    }
}
